#include <stdio.h>
#include "gpio_dev.h"
#include "sys/types.h"
#include "sys/stat.h"
#include "semaphore.h"
#include "poll.h"

int main(int argc, char **argv)
{
    printf("\n************************************************\n");
    int fd,ret;
    static gpio_groupbit_info ctrl = {0};
    fd=open("/dev/gpio",O_RDWR);
    printf("open gpio status:%d\n",fd);

    ctrl.bitnumber=26;
    ctrl.groupnumber=7;

    ctrl.direction=1;
    ctrl.value=1;
    ret=ioctl(fd,GPIO_SET_DIR,&ctrl);
    printf("######ioctl %d\n",ret);
    // ctrl.direction=0;
    // ioctl(fd,GPIO_GET_DIR,&ctrl);
    // printf("11 DIR value:%d\n",ctrl.direction);
    ioctl(fd,GPIO_WRITE_BIT,&ctrl);
    // ctrl.value=1;
    // ioctl(fd,GPIO_READ_BIT,&ctrl);
    // printf("read value:%d\n",ctrl.value);

    ret=close(fd);
    printf("close gpio status:%d\n",ret);
   
    printf("\n************************************************\n\n");
    
    return 0;
}